public class BuilderPatter {
    public static void main(String[] args) {
        House build = HouseBuilder.getBuilder().buildTv().buildBedroom().build();
    }
}

class HouseBuilder {
    House house = new House();

    static HouseBuilder getBuilder() {
        return new HouseBuilder();
    }

    HouseBuilder buildTv() {
        house.tv = 1;
        return this;
    }

    HouseBuilder buildBedroom() {
        house.bedroom = 1;
        return this;
    }

    House build() {
        return house;
    }
}

class House {
    int tv;
    int livingroom;
    int bedroom;

    public int getTv() {
        return tv;
    }

    public void setTv(int tv) {
        this.tv = tv;
    }

    public int getLivingroom() {
        return livingroom;
    }

    public void setLivingroom(int livingroom) {
        this.livingroom = livingroom;
    }

    public int getBedroom() {
        return bedroom;
    }

    public void setBedroom(int bedroom) {
        this.bedroom = bedroom;
    }
}
